//
//  FullTitleViewController.swift
//  CMDB
//
//  Created by 曹桂祥 on 17/4/6.
//  Copyright © 2017年 CMDB. All rights reserved.
//

import UIKit

class NormalTitleViewController: CustomNormalContentViewController {
    
    override func buildTitleView() {
        
        super.buildTitleView()
        
        // Title label.
        let headlinelabel           = UILabel()
        headlinelabel.font          = CMDB_20_FONT
            
            
        headlinelabel.textAlignment = .Center
        headlinelabel.textColor     = UIColor.lightGrayColor()
        headlinelabel.text          = self.title
        headlinelabel.sizeToFit()
        
        headlinelabel.center       = CGPoint(x: (self.titleView?.middlePoint.x)!, y: self.titleView!.middleY + 10)
        
        self.titleView?.addSubview(headlinelabel)
        
        let button                    = UIButton(frame : CGRect(x: 0, y: 0, width: 100, height: 64))
        button.center                 = CGPoint(x: 20, y: self.titleView!.middleY + 10)
        button.imageView?.contentMode = .Center
        button.setImage(UIImage(named: "返回"),     forState: .Normal)
        button.setImage(UIImage(named: "返回 copy"), forState: .Highlighted)
    
        self.titleView?.addSubview(button)
        
        button.addTarget(self, action: #selector(popSelf), forControlEvents: .TouchUpInside)
        
    }
    
    func popSelf() {
        
        self.popViewControllerAnimated(true)
    }
}
